package cn.kow.kmall.core.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import java.util.Date;

/**
 * @Author: lijun
 * @Description:
 * @Date: Created in 2019-05-22 9:56
 * @Modified By:
 */
@ToString
@MappedSuperclass
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class BaseEntity {

    /**
     * 状态，0：禁用， 1：正常 取值范围为0-9，不可以为null
     */
    private Short status;

    /** 是否删除  */
    @Column(name = "is_deleted")
    private Boolean deleted;

    /** 创建人  */
    private String createBy;

    /** 创建时间，第一次创建时间，后续不可以修改时间  */
    private Date createTime;

    /** 修改人  */
    private String updateBy;

    /** 修改时间，每一次修改都要更新时间 */
    private Date updateTime;

    /**
     * 版本号，乐观锁
     */
    @Version
    private Long version;

    public Short getStatus() {
        return status;
    }

    public void setStatus(Short status) {
        this.status = status;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }
}
